<script>
	import { useUserStore } from '@/stores/user.js';
	import storage from '@/utils/storage.js';
	
	export default {
		onLaunch: async function() {
			let token = storage.getStorageToken();
			if(token)
			{
				let userStore = useUserStore();
				// 获取用户信息
				await userStore.getUserInfo(token);
				uni.showToast({
					icon:'success',
					title:'自动登录成功'
				})
				// 跳转首页
				setTimeout(function() {
					uni.switchTab({
						url:'/pages/index/index'
					})
				}, 2000)
			}
			
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	/* #ifndef APP-NVUE */
	@import '@/static/customicons.css';
	// 设置整个项目的背景色
	page {
		background-color: white;
	}

	/* #endif */
	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}
</style>
